package com.ygxsk.carhome.ui.livefee;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.StringUtils;
import com.gyf.immersionbar.ImmersionBar;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
import com.tencent.mmkv.MMKV;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.constant.ConstantApi;
import com.ygxsk.carhome.constant.ConstantSign;
import com.ygxsk.carhome.constant.ExtraKey;
import com.ygxsk.carhome.enumwrap.FeeLiveOtherType;
import com.ygxsk.carhome.listener.ErrorParentExtraSingle;
import com.ygxsk.carhome.response.ProperPaymentDetailBean;
import com.ygxsk.carhome.response.PropertyPaymentBean;
import com.ygxsk.carhome.retrofit.AddLogUpLoadInfo;
import com.ygxsk.carhome.retrofit.ApiException;
import com.ygxsk.carhome.retrofit.ApiRequestSubListener;
import com.ygxsk.carhome.retrofit.ApiService;
import com.ygxsk.carhome.retrofit.ErrorConsumer;
import com.ygxsk.carhome.retrofit.NetworkManager;
import com.ygxsk.carhome.retrofit.ResponseTransformer;
import com.ygxsk.carhome.ui.ErrorActivity;
import com.ygxsk.carhome.ui.adapter.PropertyPaymentDetailAdapter;
import com.ygxsk.carhome.utils.CommUtils;
import com.ygxsk.carhome.views.MyLinearLayoutManager;
import com.ygxsk.integrated.retrofit.Parameterkey;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;

import butterknife.BindView;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Consumer;

/*
 * @Author:itchenqi175@163.com
 * @Time:2023/12/25  16:43
 * @Description:物业缴费的 查看详情，主要是金额等缴费明细等
 */
public class PaymentDetailActivity extends ErrorActivity implements ErrorParentExtraSingle {

    @BindView(R.id.refreshlayoutinpaymentdetail)
    SmartRefreshLayout refreshLayoutInproperptyMentDetail;

    @BindView(R.id.recyclerviewinpaymentdetail)
    RecyclerView recyclerViewInpaymentDetail;

    /**
     * 缴费详情顶部携带数据
     */
    private PropertyPaymentBean extra_propertyPaymentBean = null;

    //以列表形式做的单条数据
    private ArrayList<PropertyPaymentBean> mDatasResources = new ArrayList<>();

    /**
     * 从缴费记录携带实体查询的id信息
     */
    private String receiptIdPass = "";

    private PropertyPaymentDetailAdapter paymentDetailAdapter;

    //外侧有必要，因为从内侧携带，从接口又重新填充。
    //缴费方式
    private TextView textViewPaymentName;
    //缴费时间
    private TextView textpayTimeIndetail;
    //订单编号
    private TextView textPayorderNumbertop;
    //优惠券额度
    private TextView textDiscountsAmount;
    //实际缴费金额
    private TextView textFinalAmount;
    //订单总额度
    private TextView textAmountAll;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mActivityInstance = this;

        processExtraData();

        initloading();

        initViews();

        gainDatas();

    }

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();

        ImmersionBar.with(this)//
                .titleBar(R.id.toolbarygxskout)
                .fitsSystemWindows(true)//解决状态栏和布局重叠问题，任选其一，默认为false，当为true时一定要指定statusBarColor()，不然状态栏为透明色，还有一些重载方法
                //.statusBarColor(R.color.colorPrimary)//
                //.navigationBarColor(R.color.colorPrimary)//
                //.keyboardEnable(true)
                .init();

    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_payment_detail;
    }

    @Override
    protected void initToolBar(ToolbarHelper toolbarHelper) {

        toolbarHelper.setTitle(getString(R.string.title_payment_detail));

        toolbarHelper.setVersionName(true, AppUtils.getAppVersionName());
        toolbarHelper.setLayoutClose(false, "", null);
        toolbarHelper.setLayoutLeft(true, R.drawable.backicon, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                KeyboardUtils.hideSoftInput(mActivityInstance);
                methodBack();
            }
        });

        //核销的历史记录顶部啥都没有；
        toolbarHelper.setLayoutRight(false, 0, "", null);

        //添加潜在客户的按钮
//        toolbarHelper.setLayoutRight(true, 1, getString(R.string.paint_booking_history), new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//
//                //2023-07-25 21:39 携带二维码的信息;
//                  Bundle bundle = new Bundle();
//                  bundle.putInt(ExtraKey.EXTRA_QRCODE_INFO, 0);
//                  bundle.putInt(ExtraKey.BGAQRCODE_KEY, ExtraValue.BGAQRCODE_VALUE_FROM_CARD_DIST_HISTORY);
//                  ActivityUtils.startActivity(bundle, PaintBookingSumHistoryActivity.class);
//
////                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "测试代码测试点击");
//            }
//        });

    }

    @Override
    protected void onClickNodata(View v) {

        gainDatas();

    }

    @Override
    protected void initViews() {

        recyclerViewInpaymentDetail.setLayoutManager(new MyLinearLayoutManager(this));

        paymentDetailAdapter = new PropertyPaymentDetailAdapter(R.layout.propertypaymentadapterdetail, mDatasResources);
        recyclerViewInpaymentDetail.setAdapter(paymentDetailAdapter);
        paymentDetailAdapter.removeAllHeaderView();
        paymentDetailAdapter.addHeaderView(getHeaderView(recyclerViewInpaymentDetail));

        paymentDetailAdapter.notifyDataSetChanged();

        refreshLayoutInproperptyMentDetail.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(@NonNull RefreshLayout refreshLayout) {

                refreshLayout.getLayout().post(new Runnable() {
                    @Override
                    public void run() {

                        if (mDatasResources != null && !mDatasResources.isEmpty()) {
                            mDatasResources.clear();
                        }

                        if (paymentDetailAdapter != null) {
                            paymentDetailAdapter.notifyDataSetChanged();
                        }

                        getServerDatas();

                        refreshLayout.finishRefresh();
                    }
                });

            }
        });

    }

    private View getHeaderView(RecyclerView _recyclerViewWork) {

        View viewHeader;

        if ((_recyclerViewWork != null) && (_recyclerViewWork.getParent() != null)) {
            viewHeader = LayoutInflater.from(PaymentDetailActivity.this).inflate(//
                    R.layout.propertypaymentdeatilheader, //
                    (ViewGroup) _recyclerViewWork.getParent(),//
                    false);//
        } else {
            viewHeader = LayoutInflater.from(PaymentDetailActivity.this).inflate(R.layout.propertypaymentdeatilheader, null);
        }

        //这些估计到时候再接口内 需要创建变量。
        //缴费方式
        textViewPaymentName = (TextView) viewHeader.findViewById(R.id.textViewpaymentname);
        //缴费时间
        textpayTimeIndetail = (TextView) viewHeader.findViewById(R.id.textpaytimeindetail);
        //订单编号
        textPayorderNumbertop = (TextView) viewHeader.findViewById(R.id.textpayordernumbertop);
        //优惠金额
        textDiscountsAmount = (TextView) viewHeader.findViewById(R.id.textamountdiscountsAmountall);
        //实际缴费金额
        textFinalAmount = (TextView) viewHeader.findViewById(R.id.textfinalamountall);
        //费用总额度
        textAmountAll = (TextView) viewHeader.findViewById(R.id.textamountall);

        //填充携带内容,暂时用携带过来的
        if (extra_propertyPaymentBean != null) {

            String paytTypeInfo = extra_propertyPaymentBean.getPayTypeInfo();//缴费方式
            String payTime = extra_propertyPaymentBean.getPayTime();//缴费时间
            String receiptNo = extra_propertyPaymentBean.getReceiptNo();//付款单号

            BigDecimal totalAmount = extra_propertyPaymentBean.getPayAmount();//费用总额度

            String totalAmountString = "";

            if (totalAmount != null) {
                totalAmountString = MMKV.defaultMMKV().decodeString(ConstantSign.P_CURRENCYSYMBOL, StringUtils.getString(R.string.yangjiaocurrencysymbol)) + CommUtils.formatComma2BigDecimal(totalAmount);
            } else {
                totalAmountString = MMKV.defaultMMKV().decodeString(ConstantSign.P_CURRENCYSYMBOL, StringUtils.getString(R.string.yangjiaocurrencysymbol)) + CommUtils.formatComma2BigDecimal(CommUtils.valueOf(0.00));
            }

            CommUtils.setText(textViewPaymentName, TextUtils.isEmpty(paytTypeInfo) ? "" : paytTypeInfo);
            CommUtils.setText(textpayTimeIndetail, TextUtils.isEmpty(payTime) ? "" : payTime);
            CommUtils.setText(textPayorderNumbertop, TextUtils.isEmpty(receiptNo) ? "" : receiptNo);
            CommUtils.setText(textAmountAll, totalAmountString);

        }


        return viewHeader;
    }


    @Override
    protected void gainDatas() {

        if (NetworkUtils.isConnected()) {

//            getServerDatas("", "");
            getServerDatas();

        } else {

            netWorkError();
//          setEnableLoadmore(refreshLayoutInLeadsActivity, false);

        }

    }

    private void getServerDatas() {


        if (flag_jumpfrom_where == FeeLiveOtherType.TYPE_PROPERTY.getIndex()) {

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "TYPE_PROPERTY-物业缴费");

            //房间号和最后一条数据的id
            HashMap<String, Object> map = new HashMap<>();

            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());//,
//        map.put(Parameterkey.latentType, latentType_upLoad);//,潜客类型 1新车;2二手车
//        map.put(Parameterkey.createsource, createsource_upLoad);//客户来源：0预约试驾；1预约看车；2自然到店；3以旧换新
//        map.put(Parameterkey.status, status_upLoad);////跟进状态：0:待联系;1:已分配;2:有意向;3无意向;4成功;5战败;6取消预约

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETRECEIPTDETAILFORREMOTE_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.getReceiptDetailForRemote_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_GET);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            //(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
            //MediaType.parse(ApiService.HEADER_JSON))
            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .getReceiptDetailForRemote(receiptIdPass)
//                .compose(FeeWaterFragment.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<ProperPaymentDetailBean>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);
                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "handlerSomeThingNotSuccessDataForItSelf--handlerSomeThingNotSuccessDataForItSelf");

//                        methodNotSuccessData(what_method, serverCode, serverMessage);
                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {


                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--doOnSubscribe--doOnSubscribe");

//                        CommUtils.checkMaterialDialog(materialDialog);
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                            loadingGone();

                        }
                    }).subscribe(new Consumer<ProperPaymentDetailBean>() {
                        @Override
                        public void accept(ProperPaymentDetailBean properPaymentDetailBean) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

                            method_handler_success(properPaymentDetailBean);

                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；
//                        if (apiException != null) {
//                            if (!TextUtils.isEmpty(apiException.getDisplayMessage())) {
//                                ToastUtils.showShort(apiException.getDisplayMessage());
//                            }
//                        }

                            function_apiException(apiException);

                        }
                    });

        } else if (flag_jumpfrom_where == FeeLiveOtherType.TYPE_RENTAL.getIndex()) {

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "TYPE_RENTAL-租赁费过来的");

            //房间号和最后一条数据的id
            HashMap<String, Object> map = new HashMap<>();

            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());//,
//        map.put(Parameterkey.latentType, latentType_upLoad);//,潜客类型 1新车;2二手车
//        map.put(Parameterkey.createsource, createsource_upLoad);//客户来源：0预约试驾；1预约看车；2自然到店；3以旧换新
//        map.put(Parameterkey.status, status_upLoad);////跟进状态：0:待联系;1:已分配;2:有意向;3无意向;4成功;5战败;6取消预约

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETRECEIPTDETAILLIST_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.getReceiptDetailList_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_GET);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            //(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
            //MediaType.parse(ApiService.HEADER_JSON))
            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .getReceiptDetailList(receiptIdPass)
//                .compose(FeeWaterFragment.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<ProperPaymentDetailBean>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);
                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "handlerSomeThingNotSuccessDataForItSelf--handlerSomeThingNotSuccessDataForItSelf");

//                        methodNotSuccessData(what_method, serverCode, serverMessage);
                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {


                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--doOnSubscribe--doOnSubscribe");

//                        CommUtils.checkMaterialDialog(materialDialog);
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                            loadingGone();

                        }
                    }).subscribe(new Consumer<ProperPaymentDetailBean>() {
                        @Override
                        public void accept(ProperPaymentDetailBean properPaymentDetailBean) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

                            method_handler_success(properPaymentDetailBean);

                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；
//                        if (apiException != null) {
//                            if (!TextUtils.isEmpty(apiException.getDisplayMessage())) {
//                                ToastUtils.showShort(apiException.getDisplayMessage());
//                            }
//                        }

                            function_apiException(apiException);

                        }
                    });

        } else if (flag_jumpfrom_where == FeeLiveOtherType.TYPE_ELECTRIC.getIndex()//电费的
                || flag_jumpfrom_where == FeeLiveOtherType.TYPE_WATER.getIndex()) {//水费的

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "TYPE_ELECTRIC-TYPE_WATER-水费或者电费的  通用的");

            //房间号和最后一条数据的id
            HashMap<String, Object> map = new HashMap<>();

            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());//,
//        map.put(Parameterkey.latentType, latentType_upLoad);//,潜客类型 1新车;2二手车
//        map.put(Parameterkey.createsource, createsource_upLoad);//客户来源：0预约试驾；1预约看车；2自然到店；3以旧换新
//        map.put(Parameterkey.status, status_upLoad);////跟进状态：0:待联系;1:已分配;2:有意向;3无意向;4成功;5战败;6取消预约

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETRECEIPTDETAILFORREMOTE_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.getReceiptDetailForRemote_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_GET);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            //(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
            //MediaType.parse(ApiService.HEADER_JSON))
            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .getReceiptDetailForRemote(receiptIdPass)
//                .compose(FeeWaterFragment.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<ProperPaymentDetailBean>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);
                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "handlerSomeThingNotSuccessDataForItSelf--handlerSomeThingNotSuccessDataForItSelf");

//                        methodNotSuccessData(what_method, serverCode, serverMessage);
                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {


                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--doOnSubscribe--doOnSubscribe");

//                        CommUtils.checkMaterialDialog(materialDialog);
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                            loadingGone();

                        }
                    }).subscribe(new Consumer<ProperPaymentDetailBean>() {
                        @Override
                        public void accept(ProperPaymentDetailBean properPaymentDetailBean) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

                            method_handler_success(properPaymentDetailBean);

                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；
//                        if (apiException != null) {
//                            if (!TextUtils.isEmpty(apiException.getDisplayMessage())) {
//                                ToastUtils.showShort(apiException.getDisplayMessage());
//                            }
//                        }

                            function_apiException(apiException);

                        }
                    });

        }

    }

    //租赁费和物业缴费 通用的缴费详情记录
    private void method_handler_success(ProperPaymentDetailBean _properPaymentDetailBean) {

        if (mDatasResources != null) {
            mDatasResources.clear();
        }

        if (_properPaymentDetailBean != null) {

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--properPaymentDetailBean--properPaymentDetailBean");

            //顶部金额内容=====================================================================

            //缴费方式：
            CommUtils.setText(textViewPaymentName, _properPaymentDetailBean.getPayTypeInfo());

            //缴费时间
            CommUtils.setText(textpayTimeIndetail, _properPaymentDetailBean.getPayTime());

            //订单编号
            CommUtils.setText(textPayorderNumbertop, _properPaymentDetailBean.getReceiptNo());

            //优惠金额
            CommUtils.setText(textDiscountsAmount, MMKV.defaultMMKV().decodeString(ConstantSign.P_CURRENCYSYMBOL, StringUtils.getString(R.string.yangjiaocurrencysymbol)) + CommUtils.formatComma2BigDecimal(_properPaymentDetailBean.getDiscountsAmount()));

            //实际缴费金额
            CommUtils.setText(textFinalAmount, MMKV.defaultMMKV().decodeString(ConstantSign.P_CURRENCYSYMBOL, StringUtils.getString(R.string.yangjiaocurrencysymbol)) + CommUtils.formatComma2BigDecimal(_properPaymentDetailBean.getFinalAmount()));

            //费用总额度
            CommUtils.setText(textAmountAll, MMKV.defaultMMKV().decodeString(ConstantSign.P_CURRENCYSYMBOL, StringUtils.getString(R.string.yangjiaocurrencysymbol)) + CommUtils.formatComma2BigDecimal(_properPaymentDetailBean.getTotalAmount()));

            //处理列表内容=======================================================================

            ArrayList<PropertyPaymentBean> datas = _properPaymentDetailBean.getDetailList();

            if (datas != null && !datas.isEmpty()) {
                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--datas--值长度-->" + datas.size());
                if (mDatasResources != null) {
                    mDatasResources.addAll(datas);
                }
            }

            if (paymentDetailAdapter != null) {
                paymentDetailAdapter.notifyDataSetChanged();
            } else {
                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--paymentDetailAdapter--paymentDetailAdapter-是空值");
            }

        } else {
            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--properPaymentDetailBean--properPaymentDetailBean-是空值");
        }


    }

    @Override
    protected void methodBack() {

        methodBackFinish();

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

        receiptIdPass = "";

        if (extra_propertyPaymentBean != null) {
            extra_propertyPaymentBean = null;
        }

        if ((mDatasResources != null) && (!mDatasResources.isEmpty())) {

            mDatasResources.clear();

            if (paymentDetailAdapter != null) {
                paymentDetailAdapter.notifyDataSetChanged();
                paymentDetailAdapter=null;
            }

            mDatasResources = null;
        }

        if (textViewPaymentName!=null){
            textViewPaymentName=null;
        }

        if (textpayTimeIndetail!=null){
            textpayTimeIndetail=null;
        }

        if (textPayorderNumbertop!=null){
            textPayorderNumbertop=null;
        }

        if (textDiscountsAmount!=null){
            textDiscountsAmount=null;
        }

        if (textFinalAmount!=null){
            textFinalAmount=null;
        }

        if (textAmountAll!=null){
            textAmountAll=null;
        }

    }

    @Override
    public void processExtraData() {

        Bundle bundle = getIntent().getExtras();
        //use the data received here

        if (bundle != null) {

            //2024年2月5日13:50:05：标志是从哪里过来的，详情，是租赁费还是物业缴费
            flag_jumpfrom_where = bundle.getInt(ExtraKey.EXTRA_JUMPFROM_WHERE);

            extra_propertyPaymentBean = bundle.getParcelable(ExtraKey.EXTRA_PROPERTYPAYMENTBEAN);

            receiptIdPass = bundle.getString(ExtraKey.EXTRA_PAYMENT_RECEIPTID);

        }


    }
}